/*
 * Members.java
 *
 * Created on November 9, 2008, 6:20 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package jollylengkono.skripsi.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import org.apache.struts.validator.ValidatorForm;

/**
 * Entity class Members
 * 
 * @author JollkY
 */
@Entity
public class Members extends ValidatorForm implements Serializable {

    @ManyToMany(mappedBy = "recipients")
    private List<Messages> listMessages;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String username;
    private String password;
    private String firstName;
    private String lastName;
    @ManyToOne
    private Departments department;
    @ManyToOne
    private Divisions division;
    @ManyToOne
    private Groups groups;
    private String email;
    private String status;
    private String lastActivity;
    @ManyToMany
    private List<CollaborativeWorks> collaborativeWork = new ArrayList<CollaborativeWorks>();
    
    /** Creates a new instance of Members */
    public Members() {
    }

    /**
     * Gets the id of this Members.
     * @return the id
     */
    public Long getId() {
        return this.id;
    }

    /**
     * Sets the id of this Members to the specified value.
     * @param id the new id
     */
    public void setId(Long id) {
        this.id = id;
    }

    /**
     * Returns a hash code value for the object.  This implementation computes 
     * a hash code value based on the id fields in this object.
     * @return a hash code value for this object.
     */
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    /**
     * Determines whether another object is equal to this Members.  The result is 
     * <code>true</code> if and only if the argument is not null and is a Members object that 
     * has the same id field values as this object.
     * @param object the reference object with which to compare
     * @return <code>true</code> if this object is the same as the argument;
     * <code>false</code> otherwise.
     */
    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Members)) {
            return false;
        }
        Members other = (Members)object;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) return false;
        return true;
    }

    /**
     * Returns a string representation of the object.  This implementation constructs 
     * that representation based on the id fields.
     * @return a string representation of the object.
     */
    @Override
    public String toString() {
        return "jollylengkono.skripsi.model.Members[id=" + id + "]";
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public Departments getDepartment() {
        return department;
    }

    public void setDepartment(Departments department) {
        this.department = department;
    }

    public Divisions getDivision() {
        return division;
    }

    public void setDivision(Divisions division) {
        this.division = division;
    }

    public Groups getGroup() {
        return groups;
    }

    public void setGroup(Groups groups) {
        this.groups = groups;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getLastActivity() {
        return lastActivity;
    }

    public void setLastActivity(String lastActivity) {
        this.lastActivity = lastActivity;
    }

    public List<CollaborativeWorks> getCollaborativeWork() {
        return collaborativeWork;
    }

    public void setCollaborativeWork(List<CollaborativeWorks> collaborativeWork) {
        this.collaborativeWork = collaborativeWork;
    }

    public List<Messages> getListMessages() {
        return listMessages;
    }

    public void setListMessages(List<Messages> listMessages) {
        this.listMessages = listMessages;
    }

}
